Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ


Displaying Raw β€’ View rendered β€’ Download

feature/car/README.md fix/fdroid-map-rendering (113121c4) Text, 3.83 KB

Tc9d1d9# `:feature:car`

Tc9d1d9## Overview

The Ta5d6ff`:feature:car` module provides the **Android Auto integration** built on Ta5d6ff`androidx.car.app`. Ta5d6ff`MeshtasticCarAppService` is a Ta5d6ff`CarAppService` registered in the MESSAGING category (Ta5d6ff`androidx.car.app.category.MESSAGING`); each host connection gets a Ta5d6ff`MeshtasticCarSession` that wires up state, alerts, and conversation shortcuts.

**Target: Android only, `google` flavor only** β€” the module is added via Ta5d6ff`googleImplementation(projects.feature.car)` in Ta5d6ff`:androidApp`, and Ta5d6ff`FeatureCarModule` is included from the google flavor's Ta5d6ff`FlavorModule`.

Tc9d1d9## Templates Gating

Production ships **notification-only** Android Auto messaging (MessagingStyle notifications + Ta5d6ff`ConversationShortcutManager`). The full templated car app is gated:

Tff7b72- Build with Ta5d6ff`-PenableCarTemplates=true` to enable it (Internal/Closed Play tracks only).
Tff7b72- The Gradle property resolves the Ta5d6ff`carTemplatesEnabled` manifest placeholder β€” in **this module's own** Ta5d6ff`build.gradle.kts`/Ta5d6ff`AndroidManifest.xml` (a library resolves its own placeholders; the app's value does not override it) and again in Ta5d6ff`:androidApp` as defense-in-depth.
Tff7b72- The decisive host-side gate is Ta5d6ff`automotive_app_desc`'s Ta5d6ff`<uses name="template" />`; the Ta5d6ff`android:enabled="${carTemplatesEnabled}"` service flag keeps the templated service unbindable in production.

Tc9d1d9## Key Components

Tc9d1d9### Service layer (`service/`)

Tff7b72- Ta5d6ff`MeshtasticCarAppService` β€” Ta5d6ff`CarAppService`; host validation (allowlist in release, Ta5d6ff`ALLOW_ALL_HOSTS_VALIDATOR` in debug), creates sessions.
Tff7b72- Ta5d6ff`MeshtasticCarSession` β€” per-connection Ta5d6ff`Session`; starts Ta5d6ff`CarStateCoordinator`, Ta5d6ff`EmergencyHandler`, and Ta5d6ff`ConversationShortcutManager`, tags the session in Crashlytics, and returns the first Ta5d6ff`Screen`.
Tff7b72- Ta5d6ff`CarStateCoordinator` β€” bridges repository flows (nodes, messages, connection state) into car presentation state (Ta5d6ff`MessageSnapshot`, Ta5d6ff`NodeUi` in Ta5d6ff`model/CarUiModels.kt`). Created per car session.
Tff7b72- Ta5d6ff`ConversationShortcutManager` β€” publishes dynamic shortcuts for active DMs/channels so Android Auto surfaces Meshtastic conversations and links notifications to conversations via Ta5d6ff`LocusIdCompat` (the notification/reply plumbing that also serves the notification-only production path).

Tc9d1d9### Screens (`screens/`)

Tff7b72- Ta5d6ff`HomeScreen` β€” Ta5d6ff`TabTemplate` dashboard (messages / nodes / status tabs) fed by Ta5d6ff`CarStateCoordinator`.
Tff7b72- Ta5d6ff`NodeDetailScreen` β€” Ta5d6ff`PaneTemplate` detail for one node (signal, battery, last heard) with a message action.

Tc9d1d9### Emergency alerts (`alerts/`)

Tff7b72- Ta5d6ff`EmergencyHandler` β€” observes incoming Ta5d6ff`PortNum.ALERT_APP` packets, maintains the active Ta5d6ff`EmergencyAlert` list, and triggers audio tones on the car head unit.

Tc9d1d9### Util layer (`util/`)

Tff7b72- Ta5d6ff`MessageFilter` β€” decides which packets are displayable (text, non-blank, not emoji-only) and validates outgoing message byte length.
Tff7b72- Ta5d6ff`CarScreenDataBuilder` β€” pure functions converting domain models to car UI models; free of Car App Library types so they unit-test without Robolectric.
Tff7b72- Ta5d6ff`NodeSubtitleFormatter` β€” node subtitle text with signal colouring and responsive variants.
Tff7b72- Ta5d6ff`PersonIconFactory` β€” circular initial avatars for Ta5d6ff`Person` icons in MessagingStyle notifications and shortcut avatars.
Tff7b72- Ta5d6ff`CrashlyticsCarTagger` β€” sets the Ta5d6ff`car_session` Crashlytics custom key.

Tc9d1d9## Key Dependencies

From Ta5d6ff`feature/car/build.gradle.kts`:

Tff7b72- Ta5d6ff`core:common`, Ta5d6ff`core:data`, Ta5d6ff`core:database`, Ta5d6ff`core:domain`, Ta5d6ff`core:model`, Ta5d6ff`core:repository`
Tff7b72- Ta5d6ff`androidx.car.app`, Ta5d6ff`androidx.car.app.projected` (+ Ta5d6ff`androidx.car.app.testing` for tests)
Tff7b72- Ta5d6ff`koin.android`, Ta5d6ff`firebase.crashlytics` (via Firebase BoM), Ta5d6ff`kermit`

Tc9d1d9## Testing

Screen and flow tests run on the JVM via Ta5d6ff`TestCarContext` + mokkery + Robolectric (Ta5d6ff`CarScreensTest`) β€” the Desktop Head Unit cannot drive current Car App API levels. See [Tff7b72TESTING.md](Te6edf3TESTING.md) for the full recipe.

Served by rngit 1.5.4 - Generated in 0.03s